﻿
layui.use(['table', 'dropdown', 'layer', 'form'], function () {
    var upload = layui.upload;

    var element = layui.element;
    var $ = layui.$;
    var table = layui.table;
    var dropdown = layui.dropdown;
    var layer = layui.layer;
    var form = layui.form;
    var laypage = layui.laypage;
    $(function () {
        Fan();
    });
    var apiUrl = $('#apiUrl').data('url');
    window.Fan = function Fan() {
        var ingredientId = localStorage.getItem("ingredientId")
        console.log(ingredientId)
        $.ajax({
            url: '../Ingredient/IngredientFanDo',
            data: {
                IngredientId: ingredientId,
                token: ""
            },
            type: 'Get',
            success: function (res) {
                var res = JSON.parse(res)

                $.each(res, function () {

                    $("#Ingredientnumber").val(this.ingredientnumber),
                        $("#IngredientName").val(this.ingredientName),
                        $("#IngredientFen").val(this.ingredientFen),
                        form.render('select'); // 重新渲染下拉框
                    $("#size").val(this.size),
                        form.render('select'); // 重新渲染下拉框
                    $("#specification").val(this.specification),
                        form.render('select'); // 重新渲染下拉框
                    $("#Rawmaterialproperties").val(this.rawmaterialproperties),
                        form.render('select'); // 重新渲染下拉框
                    $("#unit").val(this.unit),
                        form.render('select'); // 重新渲染下拉框
                    $("#Num").val(this.num),
                        form.render('select'); // 重新渲染下拉框
                    $("#IngredientType").val(this.ingredientType),
                        form.render('select'); // 重新渲染下拉框
                    $("#State").val(this.state),
                        $("#IngredientNum").val(this.ingredientNum),
                        $("#alarmDays").val(this.alarmDays),
                        $("#InventoryLimit").val(this.inventoryLimit),
                        $("#InventoryMinimum").val(this.inventoryMinimum),
                        $("#Rawmateriallocation").val(this.rawmateriallocation),
                        $("#CreatedTimess").val(this.createdTimess),
                        $("#remark").val(this.remark),
                        $("#ID-upload-demo-img").attr("src", apiUrl + "yuan/Pic/" + this.images),
                        $("#PickingId").val(this.pickingId),
                        $("#PickingNum").val(this.pickingNum)

                })
            }
        })
    }



  
});